home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / fopen / fopdemo.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  2.6 KB  |  83 lines

  1. VERSION 2.00
  2. Begin Form FOpenDemo 
  3.    Caption         =   "Win3 Style File Open Demo"
  4.    ClientHeight    =   2655
  5.    ClientLeft      =   1230
  6.    ClientTop       =   1995
  7.    ClientWidth     =   5685
  8.    Height          =   3345
  9.    Left            =   1170
  10.    LinkMode        =   1  'Source
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   2655
  13.    ScaleWidth      =   5685
  14.    Top             =   1365
  15.    Width           =   5805
  16.    Begin Label Demo4 
  17.       Caption         =   "ThePattern: "
  18.       Height          =   375
  19.       Left            =   480
  20.       TabIndex        =   3
  21.       Top             =   2040
  22.       Width           =   4695
  23.    End
  24.    Begin Label Demo3 
  25.       Caption         =   "TheFileName: "
  26.       Height          =   375
  27.       Left            =   480
  28.       TabIndex        =   2
  29.       Top             =   1440
  30.       Width           =   4575
  31.    End
  32.    Begin Label Demo2 
  33.       Caption         =   "ThePath: "
  34.       Height          =   375
  35.       Left            =   480
  36.       TabIndex        =   1
  37.       Top             =   840
  38.       Width           =   4575
  39.    End
  40.    Begin Label Demo1 
  41.       Caption         =   "FullName: "
  42.       Height          =   375
  43.       Left            =   480
  44.       TabIndex        =   0
  45.       Top             =   240
  46.       Width           =   4575
  47.    End
  48.    Begin Menu File 
  49.       Caption         =   "&File"
  50.       Begin Menu FileOpen 
  51.          Caption         =   "&Open"
  52.       End
  53.       Begin Menu MenuSeparator1 
  54.          Caption         =   "-"
  55.       End
  56.       Begin Menu Done 
  57.          Caption         =   "&Exit"
  58.       End
  59.    End
  60. Sub Done_Click ()
  61.  ' Bye
  62.     End
  63. End Sub
  64. Sub FileOpen_Click ()
  65.  ' Before calling FOPEN.FRM we can specify a new pattern (ThePattern) a new path
  66.  ' (ThePath) and a different Form Title.  Change FullName to an empty string.
  67.     FullName = ""
  68.     ThePattern = "*.*"  ' you can also combine patterns, e.g. ThePattern = "*.BAS;*.FRM;*.TXT"
  69.     FormTitle = "Demo File Open"
  70.  ' We want to show the form Modal and Unload it after completion (no reason to
  71.  ' waste resources).
  72.     FOpenForm.Show Modal
  73.     Unload FOpenForm
  74.  ' The demo prints out the user's selection.  Note: FullName will be an empty string if
  75.  ' the user cancels.  So check FullName on return from FOPEN to see whether to process
  76.  ' the file.
  77.     If Len(FullName) = 0 Then FullName = "No File Selected"
  78.     demo1.caption = "FullName: " + FullName
  79.     demo2.caption = "ThePath: " + ThePath
  80.     demo3.caption = "TheFileName: " + TheFileName
  81.     demo4.caption = "ThePattern: " + ThePattern
  82. End Sub
  83.